#include <stdio.h>

int getCount(int m);

int main(void)
{
    int x;
    int maxDivisors = -1;
    int maxNum = 0;

    while (scanf("%d", &x) == 1 && x != -1) {
        int divisors = getCount(x);
        if (divisors >= maxDivisors) {
            maxDivisors = divisors;
            maxNum = x;
        }
    }

    if (maxDivisors >= 0)
        printf("%d %d\n", maxNum, maxDivisors);

    return 0;
}

int getCount(int m)
{
    int count = 0;
    for (int i = 1; i <= m; i++)
        if (m % i == 0)
            count++;
    return count;
}